package com.rongxun.hbwallet.jsinterface;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.webkit.JavascriptInterface;
import android.widget.TextView;
import android.widget.Toast;

import com.rongxun.hbwallet.ui.activities.ExcavateActivity;
import com.rongxun.hbwallet.ui.activities.LoginActivity;
import com.rongxun.utils.ActivityUtils;
import com.rongxun.utils.FlyLog;

/**
 * 创建者     庄丰泽
 * 创建时间   2018/6/12 14:37
 * 描述
 */

public class JsInteration {
    Context mContext;
    TextView mTitle;

    public JsInteration(Context context) {
        mContext = context;
    }

    public JsInteration(Context context, TextView title) {
        mContext = context;
        mTitle=title;
    }

    @JavascriptInterface
    public void toastMessage(String message) {

        Toast.makeText(mContext, message, Toast.LENGTH_LONG).show();
    }

    @JavascriptInterface
    public void startLogin() {
        ActivityUtils.startActivityWithAnimotionBottomToTop((Activity) mContext, new Intent(mContext, LoginActivity.class));


    }

    @JavascriptInterface
    public void startExcavate() {
        ActivityUtils.startActivityWithAnimotionBottomToTop((Activity) mContext, new Intent(mContext, ExcavateActivity.class));
    }

    @JavascriptInterface
    public void setNativeTitle(String title) {
        FlyLog.i("setNativeTitle");
        mTitle.setText(title);
//        ActivityUtils.startActivityWithAnimotionBottomToTop((Activity) mContext, new Intent(mContext, ExcavateActivity.class));
    }


}
